<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>    
<div id="page-wrap">
        <div id="main-sidebar">
            <!-- Below the including content will based on user's role in the system  -->
            <%
             JavaBeans.User user = (JavaBeans.User) session.getAttribute("user");
             if(user != null)
             {
            
             if(user.getRole() == 'e'){%>
                <jsp:include page="Left Panel/CustomerRep.jsp"/>
                <%}%>
             <%if(user.getRole() == 'm'){%>
                <jsp:include page="Left Panel/Manager.jsp"/>
                <%}%>
             <%if(user.getRole() == 'c'){%>
                <jsp:include page="Left Panel/Customer.jsp"/>
            <%}
                         }%>
            
        </div>
        <div style="overflow: auto" id="main-content">
            <%if(request.getAttribute("salereport") == null && request.getAttribute("viewstockshare") == null && 
                 request.getAttribute("stocktype") == null && request.getAttribute("stockname") == null && request.getAttribute("order") == null) {%>
            <table id="report">
                <tr>
                    <th>Stock Logo</th>
                    <th>Stock Name</th>
                    <th>Type</th>
                    <th>Symbol</th>
                    <th>Number of Share</th>
                    <th>Share Price</th>
                    <th>%Change</th><th></th>
                </tr>
                <%
                    Vector<JavaBeans.Stock> StockList = JavaBeans.Stock.getStockList();
                    Iterator<JavaBeans.Stock> i = StockList.iterator();;
                    while(i.hasNext())
                    {
                      JavaBeans.Stock temp = i.next();
                    
                %>
                <tr>
                    <td><a href="flot1.jsp?symbol=<%=temp.getSymbol()%>"><img src="images/<%=temp.getImg()%>" style="max-width: 150px;max-height: 50px" ></img></a></td>
                    <td><a href="flot1.jsp?symbol=<%=temp.getSymbol()%>"><%=temp.getName()%></a></td>
                    <td><a href="flot1.jsp?symbol=<%=temp.getSymbol()%>"><%=temp.getType()%></a></td>
                    <td><a href="flot1.jsp?symbol=<%=temp.getSymbol()%>"><%=temp.getSymbol()%></a></td>
                    <td><a href="flot1.jsp?symbol=<%=temp.getSymbol()%>"><%=temp.getNumShare()%></a></td>
                    <td><a href="flot1.jsp?symbol=<%=temp.getSymbol()%>"><%=temp.getPrice()%></a></td>
                    <td><a><% if(temp.getRate()>0) out.print("<img src=\"images/up.jpg \">"); %>
                            <% if(temp.getRate()<0) out.print("<img src=\"images/down.jpg \">"); %>
                            <% if(temp.getRate()==0) out.print("<img src=\"images/same.gif \">"); %>
                            <%  float var = temp.getRate()*100;
                                out.print((float)Math.round(var*100)/100); %>%</a></td>
                    <td><div class="arrow"></div></td>
                </tr><%}%>
            </table><%}
            else if(request.getAttribute("salereport") != null)
                                  { 
                                    %>
                <jsp:include page="Manager/resultsalesreport.jsp"/><%}
           
            else if(request.getAttribute("viewstockshare") != null)
                                  { 
                                    %>
                <jsp:include page="Customer/givenstock_result.jsp"/><%}
            else if(request.getAttribute("stocktype") != null)
                                  { 
                                    %>
                <jsp:include page="Customer/stocktype_result.jsp"/><%}
            else if(request.getAttribute("stockname") != null)
                                  { 
                                    %>
                <jsp:include page="Customer/stockname_result.jsp"/><%}
            else if(request.getAttribute("order") != null)
                {
                    out.print("<h2>Order has been placed</h2><br/><br/>");
                }
            %>
            
    </div>

    <!-- Employee Registration Dialog -->
    <div id="divModalDialog1" class="divModalDialog"><div>
        <ul>
                <jsp:include page="empregistration.jsp"/>
        </ul>
        </div></div>
    <!-- Employee Invalid Registration Dialog -->
    <div id="divModalDialog2" class="divModalDialog"><div>
            <ul>
                <jsp:include page="empregistration_invalid.jsp"/>
            </ul>
    </div></div>
    <!-- Employee Edit Registration Dialog -->
    <div id="divModalDialog3" class="divModalDialog"><div>
                <ul>
                    <jsp:include page="empregistration_invalid.jsp"/>
                </ul>
    </div></div>
    <!-- Customer Registration Dialog -->
    <div id="divModalDialog4" class="divModalDialog"><div>
        <ul>
                <jsp:include page="registration.jsp"/>
        </ul>
        </div></div>
    <!-- Customer Invalid Registration Dialog -->
    <div id="divModalDialog5" class="divModalDialog"><div>
        <ul>
                <jsp:include page="registration_invalid.jsp"/>
        </ul>
        </div></div>
        <!-- Customer Edit Registration Dialog -->
        <div id="divModalDialog6" class="divModalDialog">
            <div>
                <ul>
                    <jsp:include page="registration_invalid.jsp"/>
                </ul>
            </div>
        </div>
                
      
        </div>
       
	
    <div id="footer" align="center">
        <jsp:include page="footer.jsp"/>
    </div>
    </body>
</html>